home *** CD-ROM | disk | FTP | other *** search
- Path: news.uninet.net!usenet
- From: uni00128@uninet.net (Eric Benton)
- Newsgroups: alt.comp.lang.borland-delphi,comp.lang.basic.visual.misc,comp.lang.c++,comp.os.ms-windows.misc,comp.os.ms-windows.programmer.misc,comp.windows.misc
- Subject: Drag From File Manger to VB
- Date: Tue, 19 Mar 96 01:55:38 GMT
- Organization: Software Magix
- Message-ID: <N.031896.205538.88@anx_p13.uninet.net>
- NNTP-Posting-Host: anx_p13.uninet.net
- X-Newsreader: Quarterdeck Message Center [1.1]
-
- Hi,
- Many thanks to all those who answered my other questions on multi-font vbx's
- and
- changing the Win startup logo. Sorry I couldn't write a thanks to you all.
- New Question:
- I would like to Drag a file from File Manager to VB. I am working with
-
- Declare Sub DragAcceptfiles Lib "Shell.dll" (ByVal hWnd As Integer, ByVal Accept
- As Integer)
- Declare Function DragQueryFile Lib "Shell.dll" (ByVal hDrop As Integer, ByVal
- iFile As Integer, lpszFile$, ByVal cb As Integer) As Integer
-
- 'HDROP hDrop; /* handle of structure for dropped files */
- 'UINT iFile; /* index of file to query */ -1 to get count
- 'LPSTR lpszFile; /* address of buffer for returned filename */
- 'UINT cb; /* size of buffer for filename */
-
- ' example code from .hlp file
- 'POINT pt;
- 'WORD cFiles, a;
- 'char szFile[80];
-
- 'DragQueryPoint((HANDLE) wParam, &pt);
-
- 'cFiles = DragQueryFile((HANDLE) wParam, 0xFFFF, (LPSTR) NULL, 0);
- 'for(a = 0; a < cFiles; pt.y += 20, a++) {
- ' DragQueryFile((HANDLE) wParam, a, szFile, sizeof(szFile));
- ' TextOut(hdc, pt.x, pt.y, szFile, strlen(szFile));
- '}
-
- 'DragFinish((HANDLE) wParam);
-
- So I studied this code and ran a few tests. The problem comes in that VB will not
- trigger any events
- in response to dragging from the File Manger and Dropping on a form or list box.
- I have a vbx called MsgHook.vbx that you use by setting the msg number to true
- that you want to trap.
- ie: say you want to trap msgs WM_USER+8 WM_USER+12 and WM_USER+27
- MsgHook.hWndHook = Form1.Hwnd ' Trap only the following msgs sent to
- Form1
- MsgHook(WM_USER + 8) = True
- MsgHook(WM_USER + 12) = True
- MsgHook(WM_USER + 27) = True
- I thought, well, I'll just trap the appropriate msg and do a DragQueryFile to get
- the Handle and the
- file count and then just iterate through the file names in a like manner.
-
- The question is, what Msg do I trap? I cna't seem to 'test it out' by trial and
- error. I additem'd
- the incomming msg numbers to a list box but none seem to be specific to the
- dragdrop operation. And
- like i said VB won't trigger any.
- Thanks
- Eric
- ----
-
- uni00128@uninet.net
-
-
-